/*
 * @lc app=leetcode.cn id=1 lang=javascript
 *
 * [1] 两数之和
 */

// @lc code=start
/**
 * @param {number[]} nums
 * @param {number} target
 * @return {number[]}
 */
var twoSum = function(nums, target) {
    let hashmap=new Map()
    for (let i=0;i<nums.length;i++){
        res=target-nums[i]
        if(hashmap.has(res)){
            return [hashmap.get(res),i]
        }
        else{
            hashmap.set(nums[i],i)
        }
    }
};
// @lc code=end

a=twoSum([0,9,11,15],9)
console.log(a)
